CE 351, Fall 2020
Project 1
Name: Cesar Molina
Email: camolina@fortlewis.com
1. Title: Arduino C Programming Language Basics
2. Introduction
The purpose of this project was to introduce
students to Arduino Programming while performing six different tasks provided
in the tutorial. The tasks performed included Arduino code for If statements,
For and While loops, Data types, Switch Statements, Logic, Masks, and Pin controllers.
By the end of the project, students gained an ability to do basic coding in
Arduino UNO.
3. Materials and Methods
Materials |
Computer |
Arduino
IDE |
Arduino
UNO Kit |
To
start up this project, it is necessary to allow the Arduino board to communicate
to the PC. This was accomplished by “Serial
Communication”, where a “Serial.println” code was used to print a line of “test”
to the serial monitor. Once this connection was stablished, students were able
to run different types of coding to work on the project tasks.
Project 2 consisted of the following tasks:
1. Complete all examples in Sections 3, 4, and 5
and report the results.
2. Create a while loop example to demonstrate its
functionality
3. Explain why the result of “int A=0x1000” is “4096”
4. Use the Hex format to represent binary and
decimal numbers
5. Convert the following HEX format into Binary
6. Use a mask code to display 5 bit binary numbers
on five different LED’s.
4. Results
Figure 1: Task 1 - Serial Communication in void setup
Figure 2: Task 2 - Serial Communication in void loop
Figure 3: Task 1 - Quotation marks to print code
Figure 4: Task 1 - char code
Figure 5: Task 1 - int addition code
Figure 6: Task 1 - Arithmetic Operators
Figure 7: Task 1 - Logic Operations
Figure 8: Task 1 - Logic Operations
Figure 9: Task 1 - If statement
Figure 10: Task 1 - For statement
Figure 11: Task 1 - For statement displaying numbers 1-10
Figure 12: Task 1- If and For statement
Figure 13: Task 1 - While loop code running previous task to display numbers from 1-9
Figure 14: Task 1 - Break statement to display only 2 lines of code
Figure 15: Task 2 - While loop code example
Figure 16: Task 2 - While loop example to turn on LED when value is grater than 1000
Figure 17: Task 2 - LED off at 813
Figure 18: Task 2 - LED on from adjusting potentiometer
Figure 19: Task 2 - LED on at 1010
Figure 20: Task 3 - Hex numbers
Figure 21: Task 4 - Hex numbers to reprecent decimal and binary numbers
Figure 22: Task 5 - Hex numbers convered to binary
Figure 23: Task 6 - Mask code to turn on 5 LEDs in parallel
Figure 24: Task 6 - LEDs turned on
Figure 25: Task 3, 4, 5 - Hand Calculations
5. Discussion
All tasks were performed and executed successfully. Task 2 consisted of a while loop code that read an analog signal from a potentiometer and turned on a LED if the value was above 1000.
Very helpful tutorial to learn some Arduino basics!